package bb.lanxing.model.database;

import android.os.Parcel;
import android.os.Parcelable;
import com.alibaba.fastjson.annotation.JSONField;
//import com.orm.SugarRecord;
//import com.orm.dsl.Table;
//import com.orm.query.Select;

import org.litepal.LitePal;
import org.litepal.crud.LitePalSupport;

import java.util.ArrayList;
import java.util.List;

public class PopwindowBean extends LitePalTableBase implements Parcelable {
    public static final Parcelable.Creator<PopwindowBean> CREATOR = new Parcelable.Creator<PopwindowBean>() {

        public PopwindowBean createFromParcel(Parcel parcel) {
            return new PopwindowBean(parcel);
        }

        public PopwindowBean[] newArray(int i) {
            return new PopwindowBean[i];
        }
    };
    public static final String POP_AD = "ad";
    public static final String POP_MEDAL = "medal";
    public static final String POP_SEGMENT = "segment";
    public static final String POP_SLOPE = "workout_slope";
    public static final int REDIRECT_TYPE_MEDAL = 100;
    public static final int REDIRECT_TYPE_NO = 0;
    public static final int REDIRECT_TYPE_SEGMENT = 200;
    public static final int REDIRECT_TYPE_SLOPE = 201;
    public static final int REDIRECT_TYPE_WEBVIEW = 999;
    private int event_id;
    @JSONField(name = "id")
    private long pop_id;
    private String pop_msg_detail;
    private String pop_type;
    private String redirect_value;
    private long time_end;
    private long time_start;

    @Override
    public int describeContents() {
        return 0;
    }

    public PopwindowBean() {
    }

    protected PopwindowBean(Parcel parcel) {
        this.pop_msg_detail = parcel.readString();
        this.time_start = parcel.readLong();
        this.time_end = parcel.readLong();
        this.event_id = parcel.readInt();
        this.pop_type = parcel.readString();
        this.pop_id = parcel.readLong();
        this.redirect_value = parcel.readString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.pop_msg_detail);
        parcel.writeLong(this.time_start);
        parcel.writeLong(this.time_end);
        parcel.writeInt(this.event_id);
        parcel.writeString(this.pop_type);
        parcel.writeLong(this.pop_id);
        parcel.writeString(this.redirect_value);
    }


    public static List<PopwindowBean> getAll() {

        List<PopwindowBean> l = LitePal.findAll(PopwindowBean.class);

        return l;

//        try {
//            return Select.from(PopwindowBean.class).list();
//        } catch (Exception e) {
//            e.printStackTrace();
//            return new ArrayList();
//        }
    }

    public static List<PopwindowBean> getPopType(String str) {

        List<PopwindowBean> l = LitePal.where("pop_type=?", str).find(PopwindowBean.class);
        return l;
//        return Select.from(PopwindowBean.class).where(" POPTYPE = ? ", new String[]{String.valueOf(str)}).list();

    }

    public String getPop_msg_detail() {
        return this.pop_msg_detail;
    }

    public void setPop_msg_detail(String str) {
        this.pop_msg_detail = str;
    }

    public long getTime_start() {
        return this.time_start;
    }

    public void setTime_start(long j) {
        this.time_start = j;
    }

    public long getTime_end() {
        return this.time_end;
    }

    public void setTime_end(long j) {
        this.time_end = j;
    }

    public int getEvent_id() {
        return this.event_id;
    }

    public long getPop_id() {
        return this.pop_id;
    }

    public void setPop_id(long j) {
        this.pop_id = j;
    }

    public void setEvent_id(int i) {
        this.event_id = i;
    }

    public String getPop_type() {
        return this.pop_type;
    }

    public void setPop_type(String str) {
        this.pop_type = str;
    }

    public String getRedirect_value() {
        return this.redirect_value;
    }

    public void setRedirect_value(String str) {
        this.redirect_value = str;
    }


}
